package com.dreamsky.life.interceptor;

import com.dreamsky.life.util.Const;
import com.jfinal.aop.Interceptor;
import com.jfinal.core.ActionInvocation;

public class LifeInterceptor implements Interceptor {

	@Override
	public void intercept(ActionInvocation action) {
		String key = action.getController().getSessionAttr(Const.USER_ID_KEY);

		if (key == null) {
			action.getController().renderJson(
					"{\"success\":false,\"path\":\"index\"}");
		} else {
			action.invoke();
		}

	}

}
